import type { CategoryParams, CategoryItem, CategoryPageParams, CategoryPageResult } from './model'

const path = '/api/food/category'
export const categoryAPI = {
  search: (data: CategoryParams) => {
    return useCustomFetch<CategoryItem[]>(`${path}`, {
      method: 'GET',
      params: data
    })
  },
  page: (data: CategoryParams) => {
    return useCustomFetch<CategoryPageResult>(`${path}/page`, {
      method: 'GET',
      params: data
    })
  },
  detail: (id: number) => {
    return useCustomFetch<CategoryItem>(`${path}/${id}`, {
      method: 'GET'
    })
  }
}
